package com.macro.mall.search.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
@EnableWebSecurity
public class WebSecurityConfigextends extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .authorizeRequests()
                    .antMatchers("/search","swagger-ui").permitAll();//允许通过
//                    .antMatchers("/admin/**").hasRole("ADMIN")
//                    .antMatchers("/db/**").access("hasRole('ADMIN') and hasRole('DBA')")
//                    .anyRequest().authenticated()
//                    .and()
//                .formLogin()
//                    .usernameParameter("username")
//                    .passwordParameter("password")
//                    .failureForwardUrl("/login?error")
//                    .loginPage("/login")
//                    .permitAll()
//                    .and()
//                .logout()
//                    .logoutUrl("/logout")
//                    .logoutSuccessUrl("/index")
//                    .permitAll()
//                    .and()
//                .httpBasic()
//                    .disable();
    }
}

